<html>
return:<input id='J_read' type='text' style='width:250px' value=''><br/>
<input id='J_Pon' type='button' style='height:70px' value='_____Power on_____'> 
<input id='J_Poff' type='button' style='height:70px' value='_____Power off_____'> 
<input id='J_Pbtn' type='button' style='height:70px' value='_____Power btn_____'> 
<input id='J_S' type='button' style='height:70px' value='_____Status_______'><br/>
<textarea id='texta' style='width:500px;height:300px;'></textarea><br/><br/>
<input id='cmd' type='text' style='width:300px' value=''><br/><br/>
<input id='J_send' type='button' style='height:30px' value='send'/> 
<input id='J_receive' type='button' style='height:30px' value='receive'> 
<input id='J_clear' type='button' style='height:30px' value='clear'><br/><br/>
<input id='ctrl_c' type='button' value='^c'> 
<input id='ctrl_x' type='button' value='^x'> 
<input id='tab' type='button' value='tab'> 
<input id='up' type='button' value='up'> 
<input id='down' type='button' value='down'> 
<input id='left' type='button' value='left'> 
<input id='right' type='button' value='right'> 
<input id='esc' type='button' value='esc'> 
<input id='f1' type='button' value='f1'> 
<input id='f2' type='button' value='f2'> 
<input id='f3' type='button' value='f3'> 
<input id='f4' type='button' value='f4'> 
<input id='pageup' type='button' value='pu'> 
<input id='pagedown' type='button' value='pd'> 
<input id='backspace' type='button' value='bs'> 
<input id='del' type='button' value='del'> 
<br/><br/>
<script src='base.js' ></script>
<script>
	var calling = false;
	var texta = JQ('texta');
	var cmd = JQ('cmd');
	JQ('J_Pon').onclick=async ()=>{
		var data = await ajaxGet('/power_on','');
		JQ('J_read').value = data;
	};
	JQ('J_Poff').onclick=async ()=>{
		var data = await ajaxGet('/power_off','');
		JQ('J_read').value = data;
	};
	JQ('J_Pbtn').onclick=async ()=>{
		var data = await ajaxGet('/power_btn','');
		JQ('J_read').value = data;
	};
	JQ('J_S').onclick=async ()=>{
		var data = await ajaxGet('/status','');
		JQ('J_read').value = data;
	};
	var send = async ()=>{
		calling = true;
		await ajaxGet('/tomcu',cmd.value);
		cmd.value = '';
		calling = false;
	};
	JQ('J_send').onclick=send;
	cmd.onkeydown = (e)=>{
		if(e.key=='Enter'){
			send();
		}
	};
	JQ('J_clear').onclick=()=>{
	 texta.value = '';calling = false;
	};
	var receive = async ()=>{
		if(calling)return;
		calling = true;
		while(true){
			var data = await ajaxGet('/count','');
			var count = parseInt(data);
			if(count==0)break;
			var content = await ajaxGet('/frommcu','');
			texta.value = texta.value + content;
		};
		calling = false;
	};
	setInterval(receive, 1000);
	JQ('J_receive').onclick=function(){
		receive();
	};
	
	var special = async (num)=>{
		await ajaxGet('/special',''+num);
		JQ('J_read').value = ''+num;
	};
JQ('ctrl_c').onclick=()=>{special(0)};
JQ('ctrl_x').onclick=()=>{special(1)};
JQ('tab').onclick=()=>{special(2)};
JQ('up').onclick=()=>{special(3)};
JQ('down').onclick=()=>{special(4)};
JQ('left').onclick=()=>{special(5)};
JQ('right').onclick=()=>{special(6)};
JQ('esc').onclick=()=>{special(7)};
JQ('f1').onclick=()=>{special(8)};
JQ('f2').onclick=()=>{special(9)};
JQ('f3').onclick=()=>{special('a')};
JQ('f4').onclick=()=>{special('b')};
JQ('pageup').onclick=()=>{special('c')};
JQ('pagedown').onclick=()=>{special('d')};
JQ('backspace').onclick=()=>{special('e')};
JQ('del').onclick=()=>{special('f')};

	
</script>
end</html>
